// run: $exec < input
// opt: 0
// flag: -g
#include <cstdio>

struct Node
{
	int size;
	bool root;
	Node * parent, * child[2];
};

int const maxn = 200007;
Node memory[maxn];
Node & nil = memory[0];
int n, m;

void update(Node & u)
{
	u.size = u.child[0]->size + u.child[1]->size + 1;
}

void rotate(Node & u, int c)
{
	Node & v = *u.parent;
	v.child[c ^ 1] = u.child[c];
	if (u.child[c] != &nil)
		u.child[c]->parent = &v;
	u.parent = v.parent;
	if (u.parent != &nil) {
		if (&v == v.parent->child[1])
			u.parent->child[1] = &u;
		else if (&v == v.parent->child[0])
			u.parent->child[0] = &u;
	}
	u.child[c] = &v;
	v.parent = &u;
	u.root = v.root;
	v.root = false;
	update(v);
}

void splay(Node & u)
{
	for (Node * v; !u.root; ) {
		if ((v = u.parent)->root) {
			rotate(u, &u == v->child[0]);
			break;
		}
		int c = (v == v->parent->child[0]);
		if (&u == v->child[c]) {
			rotate(u, c ^ 1);
			rotate(u, c);
		} else {
			rotate(*v, c);
			rotate(u, c);
		}
	}
	update(u);
}

void lct_access(Node & u)
{
	for (splay(u); u.parent != &nil; splay(u)) {
		Node & v = *u.parent;
		splay(v);
		v.child[1]->root = true;
		v.child[1] = &u;
		u.root = false;
	}
}

int main()
{
	nil.child[0] = nil.child[1] = nil.parent = &nil;
	std::scanf("%d", &n);
	int last_node = n + 1;
	for (int i = 1, x; i <= n; i++) {
		std::scanf("%d", &x);
		Node & node = memory[i];
		node.parent = &(i + x <= n ? memory[i + x] : memory[last_node]);
		node.child[0] = node.child[1] = &nil;
		node.root = node.size = 1;
	}
	Node & last = memory[n + 1];
	last.parent = last.child[0] = last.child[1] = &nil;
	last.root = last.size = 1;

	std::scanf("%d", &m);
	for (int i = 0, op, x, y; i < m; i++) {
		std::scanf("%d %d", &op, &x);
		Node & node = memory[++x];
		if (op == 1) {
			lct_access(node);
			std::printf("%d\n", node.child[0]->size);
		} else {
			std::scanf("%d", &y);
			splay(node);
			node.child[0]->root = true;
			node.child[0]->parent = node.parent;
			node.child[0] = &nil;
			node.parent = &(x + y <= n ? memory[x + y] : memory[last_node]);
		}
	}
}

